<template>
  <div class="l-rblock" v-if="!lr_loadPage">
    <wf-create-form
      ref="form"
      wraperType="full"
      :code="myWfcode" 

      :params="myWfParams"
      :isLoadFormData="true"

      :showClose="false"
      :visible="visible"
      
      @refresh="refresh" 
    />
  </div>
</template>

<script>
export default {
  data() {
    return {
      lr_isPage: false,
      myWfcode:'',
      myWfType:'',
      myWfParams:{},
      visible:false,
    };
  },
  computed: {},
  created() {
    this.init();
  },
  methods: {
    async init() {
      if(this.$route.query.id){
        this.myWfParams = {processId: this.$route.query.id}
        this.myWfType = "draft"
      }
      else{
        this.myWfType = "";
        this.myWfParams = {};
        this.myWfcode  = this.$route.query.code;
      }

      setTimeout(()=>{
        this.visible = true;
      })
    },
    refresh(){
      window.close();
    }
  },
};
</script>
